#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  string arr1;cin >>arr1;
  string arr2;cin >>arr2;
  sort(arr1.begin(),arr1.end());
  if(arr1==arr2) cout <<"YES"<<endl;
  else cout <<"NO"<<endl;
  return 0;
}
